home *** CD-ROM | disk | FTP | other *** search
- #!/bin/sh
-
- set -e
-
- syssite=/usr/lib/python2.6/site-packages
- oldsite=/usr/lib/python2.6/old-site-packages
- localsite=/usr/local/lib/python2.6/dist-packages
- syslink=../../${localsite#/usr/*}
-
- move_site_packages()
- {
- [ -d $localsite ] || mkdir -p $localsite
-
- if [ -h $syssite ]; then
- :
- elif [ -d $syssite ]; then
- for i in $(find $syssite -mindepth 1 -maxdepth 1 -printf '%P\n'); do
- echo "Moving $syssite/$i to new location:"
- if [ ! -e $localsite/$i ]; then
- echo " --> $localsite/$i"
- mv $syssite/$i $localsite/
- elif [ ! -e $oldsite/$i ]; then
- echo " --> $oldsite/$i (already exist in $localsite/"
- mv $syssite/$i $oldsite/
- else
- echo " already exists in $localsite/ and $oldsite/"
- echo " please proceed manually"
- exit 1
- fi
- done
- echo "removing $syssite"
- rmdir $syssite
- #echo "symlinking $syssite to $localsite"
- #ln -s $syslink $syssite
- else
- :
- #ln -sf $syslink $syssite
- fi
- }
-
- case "$1" in
- install)
- # there never was a python2.6 package using site-packages.
- #if [ -n "$2" ] && dpkg --compare-versions "$2" lt '2.6.1-0'; then
- # move_site_packages
- #fi
- if [ -z "$2" ] && [ -d $syssite ] && [ ! -h $syssite ]; then
- echo "new installation of python2.6-minimal; $syssite is a directory"
- echo "which is expected a symlink to $localsite."
- echo "please find the package shipping files in $syssite and"
- echo "file a bug report to ship these in /usr/lib/python2.6/dist-packages instead"
- echo "aborting installation of python2.6-minimal"
- exit 1
- fi
-
- # remember newly installed runtime
- mkdir -p /var/lib/python
- touch /var/lib/python/python2.6_installed
- ;;
- upgrade)
- if [ -n "$2" ] && dpkg --compare-versions "$2" lt '3.0~rc1'; then
- move_site_packages
- fi
- ;;
-
- abort-upgrade)
- ;;
-
- *)
- echo "preinst called with unknown argument \`$1'" >&2
- exit 1
- ;;
- esac
-
-
-
- exit 0
-